<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - entropy_decoder_model_kernel_3.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2004  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_ENTROPY_DECODER_MODEL_KERNEl_3_
<font color='#0000FF'>#define</font> DLIB_ENTROPY_DECODER_MODEL_KERNEl_3_

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='entropy_decoder_model_kernel_abstract.h.html'>entropy_decoder_model_kernel_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../assert.h.html'>../assert.h</a>"

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> alphabet_size,
        <font color='#0000FF'>typename</font> entropy_decoder,
        <font color='#0000FF'>typename</font> cc,
        <font color='#0000FF'>typename</font> cc_high
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>class</font> <b><a name='entropy_decoder_model_kernel_3'></a>entropy_decoder_model_kernel_3</b> 
    <b>{</b>
        <font color='#009900'>/*!
            REQUIREMENTS ON cc
                cc is an implementation of conditioning_class/conditioning_class_kernel_abstract.h
                cc::get_alphabet_size() == alphabet_size+1

            REQUIREMENTS ON cc_high
                cc_high is an implementation of conditioning_class/conditioning_class_kernel_abstract.h
                cc_high::get_alphabet_size() == alphabet_size+1

            INITIAL VALUE
                - Initially this object's finite context model is empty
                - previous_symbol == 0
                - previous_symbol2 == 0
                - order_1 == pointer to an array of alphabet_size elements
                - order_2 == pointer to an array of alphabet_size*alphabet_size elements
                - for all values of i: order_2[i] == 0

            CONVENTION
                &amp;get_entropy_encoder() == coder
                &amp;order_0.get_global_state() == &amp;gs
                &amp;order_1[i]-&gt;get_global_state() == &amp;gs

                if (order_2[i] != 0) then
                    &amp;order_2[i]-&gt;get_global_state() == &amp;gs_high

                This is an order-2-1-0 model. The last symbol in the order-2, order-1 and 
                order-0 contexts is an escape into the lower context.

                previous_symbol == the last symbol seen
                previous_symbol2 == the symbol we saw before previous_symbol
        !*/</font>

    <font color='#0000FF'>public</font>:

        <font color='#0000FF'>typedef</font> entropy_decoder entropy_decoder_type;

        <b><a name='entropy_decoder_model_kernel_3'></a>entropy_decoder_model_kernel_3</b> <font face='Lucida Console'>(</font>
            entropy_decoder<font color='#5555FF'>&amp;</font> coder
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>virtual</font> ~<b><a name='entropy_decoder_model_kernel_3'></a>entropy_decoder_model_kernel_3</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;
        
        <font color='#0000FF'>inline</font> <font color='#0000FF'><u>void</u></font> <b><a name='clear'></a>clear</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>inline</font> <font color='#0000FF'><u>void</u></font> <b><a name='decode'></a>decode</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&amp;</font> symbol
        <font face='Lucida Console'>)</font>;

        entropy_decoder<font color='#5555FF'>&amp;</font> <b><a name='get_entropy_decoder'></a>get_entropy_decoder</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> coder; <b>}</b>

        <font color='#0000FF'>static</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='get_alphabet_size'></a>get_alphabet_size</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> alphabet_size; <b>}</b>

    <font color='#0000FF'>private</font>:

        entropy_decoder<font color='#5555FF'>&amp;</font> coder;
        <font color='#0000FF'>typename</font> cc::global_state_type gs;
        <font color='#0000FF'>typename</font> cc_high::global_state_type gs_high;
        cc order_0;
        cc<font color='#5555FF'>*</font><font color='#5555FF'>*</font> order_1;
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> previous_symbol;
        cc_high<font color='#5555FF'>*</font><font color='#5555FF'>*</font> order_2;
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> previous_symbol2;

        <font color='#009900'>// restricted functions
</font>        <b><a name='entropy_decoder_model_kernel_3'></a>entropy_decoder_model_kernel_3</b><font face='Lucida Console'>(</font>entropy_decoder_model_kernel_3<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>;        <font color='#009900'>// copy constructor
</font>        entropy_decoder_model_kernel_3<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>entropy_decoder_model_kernel_3<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>;    <font color='#009900'>// assignment operator
</font>
    <b>}</b>;   

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>    <font color='#009900'>// member function definitions
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> alphabet_size,
        <font color='#0000FF'>typename</font> entropy_decoder,
        <font color='#0000FF'>typename</font> cc,
        <font color='#0000FF'>typename</font> cc_high
        <font color='#5555FF'>&gt;</font>
    entropy_decoder_model_kernel_3<font color='#5555FF'>&lt;</font>alphabet_size,entropy_decoder,cc,cc_high<font color='#5555FF'>&gt;</font>::
    <b><a name='entropy_decoder_model_kernel_3'></a>entropy_decoder_model_kernel_3</b> <font face='Lucida Console'>(</font>
        entropy_decoder<font color='#5555FF'>&amp;</font> coder_
    <font face='Lucida Console'>)</font> : 
        coder<font face='Lucida Console'>(</font>coder_<font face='Lucida Console'>)</font>,
        order_0<font face='Lucida Console'>(</font>gs<font face='Lucida Console'>)</font>,
        order_1<font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>,
        previous_symbol<font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>,
        order_2<font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>,
        previous_symbol2<font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font> <font color='#979000'>1</font> <font color='#5555FF'>&lt;</font> alphabet_size <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> alphabet_size <font color='#5555FF'>&lt;</font> <font color='#979000'>65535</font><font face='Lucida Console'>)</font>;

        <font color='#0000FF'>try</font>
        <b>{</b>
            order_1 <font color='#5555FF'>=</font> <font color='#0000FF'>new</font> cc<font color='#5555FF'>*</font>[alphabet_size];
            order_2 <font color='#5555FF'>=</font> <font color='#0000FF'>new</font> cc_high<font color='#5555FF'>*</font>[alphabet_size<font color='#5555FF'>*</font>alphabet_size];
        <b>}</b>
        <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>...<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order_1<font face='Lucida Console'>)</font> <font color='#0000FF'>delete</font> [] order_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order_2<font face='Lucida Console'>)</font> <font color='#0000FF'>delete</font> [] order_2;
            <font color='#0000FF'>throw</font>;
        <b>}</b>


        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i;

        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> alphabet_size<font color='#5555FF'>*</font>alphabet_size; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            order_2[i] <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <b>}</b>

        <font color='#0000FF'>try</font>
        <b>{</b>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> alphabet_size; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
            <b>{</b>
                order_1[i] <font color='#5555FF'>=</font> <font color='#0000FF'>new</font> <font color='#BB00BB'>cc</font><font face='Lucida Console'>(</font>gs<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
        <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>...<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> j <font color='#5555FF'>=</font> <font color='#979000'>0</font>; j <font color='#5555FF'>&lt;</font> i; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>j<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>delete</font> order_1[j];
            <b>}</b>
            <font color='#0000FF'>throw</font>;
        <b>}</b>
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> alphabet_size,
        <font color='#0000FF'>typename</font> entropy_decoder,
        <font color='#0000FF'>typename</font> cc,
        <font color='#0000FF'>typename</font> cc_high
        <font color='#5555FF'>&gt;</font>
    entropy_decoder_model_kernel_3<font color='#5555FF'>&lt;</font>alphabet_size,entropy_decoder,cc,cc_high<font color='#5555FF'>&gt;</font>::
    ~<b><a name='entropy_decoder_model_kernel_3'></a>entropy_decoder_model_kernel_3</b> <font face='Lucida Console'>(</font>
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> alphabet_size; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>delete</font> order_1[i];
        <b>}</b>

        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> alphabet_size<font color='#5555FF'>*</font>alphabet_size; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order_2[i] <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
                <font color='#0000FF'>delete</font> order_2[i];
        <b>}</b>
        <font color='#0000FF'>delete</font> [] order_1;
        <font color='#0000FF'>delete</font> [] order_2;
    <b>}</b>
    
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> alphabet_size,
        <font color='#0000FF'>typename</font> entropy_decoder,
        <font color='#0000FF'>typename</font> cc,
        <font color='#0000FF'>typename</font> cc_high
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> entropy_decoder_model_kernel_3<font color='#5555FF'>&lt;</font>alphabet_size,entropy_decoder,cc,cc_high<font color='#5555FF'>&gt;</font>::
    <b><a name='clear'></a>clear</b><font face='Lucida Console'>(</font>
    <font face='Lucida Console'>)</font>
    <b>{</b>
        previous_symbol <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        previous_symbol2 <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        order_0.<font color='#BB00BB'>clear</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> alphabet_size; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            order_1[i]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>clear</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> alphabet_size<font color='#5555FF'>*</font>alphabet_size; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order_2[i] <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>delete</font> order_2[i];
                order_2[i] <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <b>}</b>
        <b>}</b>
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> alphabet_size,
        <font color='#0000FF'>typename</font> entropy_decoder,
        <font color='#0000FF'>typename</font> cc,
        <font color='#0000FF'>typename</font> cc_high
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> entropy_decoder_model_kernel_3<font color='#5555FF'>&lt;</font>alphabet_size,entropy_decoder,cc,cc_high<font color='#5555FF'>&gt;</font>::
    <b><a name='decode'></a>decode</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&amp;</font> symbol
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> current_symbol, low_count, high_count, target;


        <font color='#009900'>// look in the order-2 context        
</font>        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> temp <font color='#5555FF'>=</font> previous_symbol <font color='#5555FF'>+</font> <font face='Lucida Console'>(</font>previous_symbol2 <font color='#5555FF'>*</font> alphabet_size<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order_2[temp] <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            target <font color='#5555FF'>=</font> coder.<font color='#BB00BB'>get_target</font><font face='Lucida Console'>(</font>order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_total</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_symbol</font><font face='Lucida Console'>(</font>target,current_symbol,low_count,high_count<font face='Lucida Console'>)</font>;

            <font color='#009900'>// have the coder decode the next symbol
</font>            coder.<font color='#BB00BB'>decode</font><font face='Lucida Console'>(</font>low_count,high_count<font face='Lucida Console'>)</font>;

            <font color='#009900'>// if the current_symbol is not an escape from the order-2 context
</font>            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>current_symbol <font color='#5555FF'>!</font><font color='#5555FF'>=</font> alphabet_size<font face='Lucida Console'>)</font>
            <b>{</b>
                symbol <font color='#5555FF'>=</font> current_symbol;
                order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;
                previous_symbol2 <font color='#5555FF'>=</font> previous_symbol;
                previous_symbol <font color='#5555FF'>=</font> current_symbol;
                <font color='#0000FF'>return</font>;
            <b>}</b>

            <font color='#009900'>// since this is an escape to order-1 we should increment
</font>            <font color='#009900'>// the escape symbol
</font>            order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>alphabet_size<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font>
        <b>{</b>
            order_2[temp] <font color='#5555FF'>=</font> <font color='#0000FF'>new</font> <font color='#BB00BB'>cc_high</font><font face='Lucida Console'>(</font>gs_high<font face='Lucida Console'>)</font>;
        <b>}</b>
        





        <font color='#009900'>// look in the order-1 context
</font>        target <font color='#5555FF'>=</font> coder.<font color='#BB00BB'>get_target</font><font face='Lucida Console'>(</font>order_1[previous_symbol]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_total</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        order_1[previous_symbol]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>get_symbol</font><font face='Lucida Console'>(</font>target,current_symbol,low_count,high_count<font face='Lucida Console'>)</font>;

        <font color='#009900'>// have the coder decode the next symbol
</font>        coder.<font color='#BB00BB'>decode</font><font face='Lucida Console'>(</font>low_count,high_count<font face='Lucida Console'>)</font>;

        <font color='#009900'>// if the current_symbol is not an escape from the order-1 context
</font>        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>current_symbol <font color='#5555FF'>!</font><font color='#5555FF'>=</font> alphabet_size<font face='Lucida Console'>)</font>
        <b>{</b>
            symbol <font color='#5555FF'>=</font> current_symbol;
            order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;
            order_1[previous_symbol]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;            
            previous_symbol2 <font color='#5555FF'>=</font> previous_symbol;
            previous_symbol <font color='#5555FF'>=</font> current_symbol;
            <font color='#0000FF'>return</font>;
        <b>}</b>
            
        <font color='#009900'>// since this is an escape to order-0 we should increment
</font>        <font color='#009900'>// the escape symbol
</font>        order_1[previous_symbol]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>alphabet_size<font face='Lucida Console'>)</font>;



        <font color='#009900'>// look in the order-0 context
</font>        target <font color='#5555FF'>=</font> coder.<font color='#BB00BB'>get_target</font><font face='Lucida Console'>(</font>order_0.<font color='#BB00BB'>get_total</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        order_0.<font color='#BB00BB'>get_symbol</font><font face='Lucida Console'>(</font>target,current_symbol,low_count,high_count<font face='Lucida Console'>)</font>;

        <font color='#009900'>// have coder decode the next symbol
</font>        coder.<font color='#BB00BB'>decode</font><font face='Lucida Console'>(</font>low_count,high_count<font face='Lucida Console'>)</font>;

        <font color='#009900'>// if current_symbol is not an escape from the order-0 context
</font>        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>current_symbol <font color='#5555FF'>!</font><font color='#5555FF'>=</font> alphabet_size<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// update the count for this symbol
</font>            order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;            
            order_1[previous_symbol]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;
            order_0.<font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;
            

            symbol <font color='#5555FF'>=</font> current_symbol;
            previous_symbol2 <font color='#5555FF'>=</font> previous_symbol;
            previous_symbol <font color='#5555FF'>=</font> current_symbol;
            <font color='#0000FF'>return</font>;
        <b>}</b>

        <font color='#009900'>// update the count for the escape symbol
</font>        order_0.<font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>current_symbol<font face='Lucida Console'>)</font>;


        <font color='#009900'>// go into the order minus one context
</font>        target <font color='#5555FF'>=</font> coder.<font color='#BB00BB'>get_target</font><font face='Lucida Console'>(</font>alphabet_size<font face='Lucida Console'>)</font>;
        coder.<font color='#BB00BB'>decode</font><font face='Lucida Console'>(</font>target,target<font color='#5555FF'>+</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;


        <font color='#009900'>// update the count for this symbol 
</font>        order_2[temp]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>target,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;            
        order_1[previous_symbol]<font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>target,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;
        order_0.<font color='#BB00BB'>increment_count</font><font face='Lucida Console'>(</font>target,<font color='#979000'>2</font><font face='Lucida Console'>)</font>;
        

        symbol <font color='#5555FF'>=</font> target;
        previous_symbol2 <font color='#5555FF'>=</font> previous_symbol;
        previous_symbol <font color='#5555FF'>=</font> target;
    
       
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>  
<b>}</b>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_ENTROPY_DECODER_MODEL_KERNEl_3_
</font>

</pre></body></html>